home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Utilities / Interfaces / InfoUtil.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  8.4 KB  |  245 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        InfoUtil.h
  3.  
  4.     Contains:    function declarations Info getters & setters
  5.  
  6.     Owned by:    Tantek Çelik
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     
  11.     In Progress:
  12.         
  13. */
  14.  
  15.  
  16. #ifndef _INFOUTIL_
  17. #define _INFOUTIL_
  18.  
  19. #ifndef _ODTYPES_
  20. #include <ODTypes.h>
  21. #endif
  22.  
  23. #ifndef __CONTROLS__
  24. #include <Controls.h>
  25. #endif
  26.  
  27. #ifndef SOM_ODWindowState_xh
  28. #include <WinStat.xh>
  29. #endif
  30.  
  31. #ifndef SOM_ODNameSpaceManager_xh
  32. #include "NmSpcMg.xh"
  33. #endif
  34.  
  35. #ifndef _ORDCOLL_
  36. #include "OrdColl.h"
  37. #endif
  38.  
  39. //==============================================================================
  40. // Theory of Operation
  41. //==============================================================================
  42.  
  43. //==============================================================================
  44. // Constants
  45. //==============================================================================
  46.  
  47. //==============================================================================
  48. // Scalar Types
  49. //==============================================================================
  50.  
  51. //==============================================================================
  52. // Classes used by this interface
  53. //==============================================================================
  54.  
  55. class    ODFrame;
  56. class    ODStorageUnit;
  57. class    ODPart;
  58. class    ODPersistentObject;
  59. class    ODTypeList;
  60. class    EditorSet;
  61. class    ODSession;
  62. class    PlatformFile;
  63.  
  64. //==============================================================================
  65. // Info functions
  66. //==============================================================================
  67.  
  68. #ifdef _OD_IMPL_SHARE_UTILS_
  69. #pragma import on
  70. #endif
  71.  
  72. extern "C" {
  73.  
  74.  
  75.  
  76. //-------------------------------------------------------------------------------------
  77. // Persistent Object Property getters and setters
  78. // Note: 
  79. //  all Getters expect you to pass in a buffer to be filled 
  80. //  or kODNULL which causes it to create one for you
  81. //  all Setters do NOT consume what you pass in, so it is safe to pass in
  82. //     a reference to your internal structures.  They are only accessed for the duration
  83. //     of the Setter API call.
  84. // These conventions were adopted to reduce memory allocation/deallocation.
  85. //-------------------------------------------------------------------------------------
  86.  
  87. ODULong        ODGetCreationDate(Environment* ev, 
  88.                 ODStorageUnit* su);
  89. void        ODSetCreationDate(Environment* ev, 
  90.                 ODStorageUnit* su,
  91.                 ODTime dateTime);
  92.                 
  93. ODULong        ODGetModificationDate(Environment* ev, 
  94.                 ODStorageUnit* su);
  95. void        ODSetModificationDate(Environment* ev, 
  96.                 ODStorageUnit* su,
  97.                 ODTime dateTime);
  98.                 
  99. ODIText*    ODGetModifiedBy(Environment* ev, 
  100.                 ODStorageUnit* su,ODIText* userName);
  101. void        ODSetModifiedBy(Environment* ev, 
  102.                 ODStorageUnit* su, ODIText* userName);
  103.  
  104.  
  105. ODStorageUnit* ODGetSUFromPstObj(Environment* ev, ODPersistentObject* pstobj);
  106.  
  107. ODIText*    ODGetPOComments(Environment* ev,  ODPart* part, ODIText* comments);
  108. void        ODSetPOComments(Environment* ev, ODPart* part, ODIText* comments);
  109.  
  110. ODIconFamily    ODGetPOIconFamily(Environment* ev,
  111.                     ODPart* part);
  112. void        ODSetPOIconFamily(Environment* ev, 
  113.                     ODPart* part, ODIconFamily iconFamily,
  114.                     ODBoolean deleteOtherPlatformIcons =kODTrue);
  115.  
  116. ODULong        ODGetPOSize(Environment* ev, 
  117.                 ODPersistentObject* pstobj);
  118. ODID        ODGetPOID(Environment* ev, 
  119.                 ODPersistentObject* pstobj);
  120.  
  121. // Note: the next two functions are lowlevel functions for directly setting
  122. // and getting the name property of persistent objects.  
  123. // If you are dealing with a part, please use ODGetPartName & ODSetPartName
  124. // in order to make sure the right thing happens with respect to 
  125. // the document file, titles of windows etc.  -Tantek
  126. ODIText*    ODGetPOName(Environment* ev, 
  127.                         ODPersistentObject* pstobj,ODIText* name);
  128. void        ODSetPOName(Environment* ev, 
  129.                         ODPersistentObject* pstobj,ODIText* name);
  130.  
  131. // The next function is used when the persistent object is not internalized yet. - Vincent
  132. void        ODSetPONameUsingSU(Environment* ev, ODStorageUnit* su, ODIText* name);
  133.  
  134. //-------------------------------------------------------------------------------------
  135. // Part only Property getters and setters
  136. //-------------------------------------------------------------------------------------
  137.  
  138. ODIText*    ODGetPartName(Environment* ev, 
  139.                 ODFrame* frame,ODIText* name);
  140.         // Returns the name of the part of the frame passed in.
  141.  
  142. ODBoolean    ODSetPartName(Environment* ev, 
  143.                 ODFrame* frame, ODIText* name, DescType replaceOption);
  144.         // Renames the part of the frame passed in.
  145.         // Returns whether or not it succeeded.
  146.         // The frame helps more easily determine whether
  147.         // the part is the root part of the document or not.
  148.         // For example, renaming the root part of the document could fail
  149.         // if there was a file with the same name and the user canceled the
  150.         // "Replace?" dialog.
  151.  
  152. void        ODRenamePartWindows( Environment *ev, ODSession *session, ODPart *part,
  153.                                  ODIText *oldName, ODIText *name );
  154.         // Renames windows with 'part' as their root part. Subroutine used
  155.         // by ODSetPartName; not usually needed for other purposes (although
  156.         // the Shell does use it.)
  157.  
  158.  
  159. ODIText*    ODGetComments(Environment* ev,  ODFrame* frame, ODIText* comments);
  160. void        ODSetComments(Environment* ev, ODFrame* frame, ODIText* comments);
  161.  
  162. ODName*        ODGetCategory(Environment* ev, ODPart* part, ODNameSpaceManager* nsm);
  163. ODName*        ODGetCatFromPartSU(Environment* ev, ODStorageUnit* su, ODNameSpaceManager* nsm);
  164. ODName*        ODGetCatFromKind(Environment* ev, ODType kind, ODNameSpaceManager* nsm);
  165.  
  166. ODType        ODGetKind(Environment* ev, ODPart* part);
  167. ODType        ODGetKindFromPartSU(Environment* ev, ODStorageUnit* su);
  168. ODPlatformType ODGetIconFilePlatformTypeFromPartSU(Environment* ev, 
  169.         ODStorageUnit* su);
  170.  
  171. ODIconFamily    ODGetIconFamily(Environment* ev,
  172.                     ODFrame* frame);
  173. void        ODSetIconFamily(Environment* ev, 
  174.                     ODFrame* frame, ODIconFamily iconFamily,
  175.                     ODBoolean deleteOtherPlatformIcons =kODTrue);
  176.  
  177. ODBoolean    ODGetIsStationery(Environment* ev, 
  178.                 ODFrame* frame);
  179. void        ODSetIsStationery(Environment* ev, 
  180.                 ODFrame* frame, ODBoolean isStationery);
  181.  
  182. ODBoolean        ODGetSUIsStationery(Environment* ev, ODStorageUnit* su);
  183. void        ODSetSUIsStationery(Environment* ev, 
  184.                 ODStorageUnit* su, ODBoolean isStationery);
  185.  
  186. //-------------------------------------------------------------------------------------
  187. // Frame only Property getters and setters
  188. //-------------------------------------------------------------------------------------
  189. // see Frame.idl
  190.  
  191.  
  192. //-------------------------------------------------------------------------------------
  193. // General Utility functions
  194. //-------------------------------------------------------------------------------------
  195.  
  196. void SetAllWindowShowLinks(Environment* ev, ODWindowState* winState, ODBoolean showLinks);
  197. PlatformFile*    ODGetFileIfRoot(Environment* ev, ODFrame* frame);
  198.  
  199. ODBoolean    ODAskUserReplace(Environment* ev,
  200.                             ODSession* session);
  201. // Pass in the name in question via ParamText(^0).
  202.  
  203. //-------------------------------------------------------------------------------------
  204. // Editor and Kind popup Menu manipulation functions
  205. // copied from LinkDlgs.cpp (!with changes by TÇ and CG)
  206. //-------------------------------------------------------------------------------------
  207. // private by convention.
  208.  
  209. void AddTypesToMenu(ODTypeList* kindList, 
  210.                                 MenuHandle kindMenu, 
  211.                                 ODSession* session);
  212. ODUShort EnableTypesInMenu(ODTypeList* typeList,
  213.                                 MenuHandle kindMenu,
  214.                                 ODEditor editor,
  215.                                 ODNameSpaceManager* nsm);
  216. ODBoolean SetupEditorMenu(ODType kind,
  217.                                 EditorSet* editorList,
  218.                                 MenuHandle editorMenu, 
  219.                                 ControlHandle popupCtlHndl, 
  220.                                 ODSession* session);
  221. void AddEditorsToMenu(EditorSet* editorList,
  222.                                 MenuHandle editorMenu, 
  223.                                 ODSession* session);
  224. void ContentValueTypes(ODStorageUnit* contentSU, ODTypeList* typeList);
  225. ODEditor GetThisEditorFromList(ODSShort editorIndex, EditorSet* editorList);
  226. ODType GetThisKindFromList(ODSShort kindItem, ODTypeList* kindList);
  227. ODSShort IndexOfEditorInList(EditorSet* editorsList, ODEditor editor);
  228. ODSShort IndexOfKindInList(ODTypeList* kindList, ODType kind);
  229. void TranslateValueTypes(ODTypeList* kindList,
  230.                                 ODTypeList* translateToList,
  231.                                 OrderedCollection* translateFromList,
  232.                                 ODSession* session);
  233. void AddTranslationKindToMenu(ODType        kind, 
  234.                                 MenuHandle    kindMenu,
  235.                                 short        item,
  236.                                 ODBoolean    insert,
  237.                                 ODSession*    session);
  238. }    // End of extern "C" {
  239.  
  240. #ifdef _OD_IMPL_SHARE_UTILS_
  241. #pragma import off
  242. #endif
  243.  
  244. #endif // _INFOUTIL_
  245.